package com.dianping.cat.home.storage.alert.entity;

import com.dianping.cat.home.storage.alert.BaseEntity;
import com.dianping.cat.home.storage.alert.IVisitor;
import java.util.LinkedHashMap;
import java.util.Map;






public class Operation
  extends BaseEntity<Operation>
{
  private String m_id;
  private int m_level;
  private int m_count;
/*  19 */   private Map<String, Target> m_targets = new LinkedHashMap();





  public Operation(String id) { this.m_id = id; }




/*  30 */   public void accept(IVisitor visitor) { visitor.visitOperation(this); }


  public Operation addTarget(Target target) {
/*  34 */     this.m_targets.put(target.getId(), target);
/*  35 */     return this;
  }


  public boolean equals(Object obj) {
/*  40 */     if (obj instanceof Operation) {
/*  41 */       Operation _o = (Operation)obj;

/*  43 */       if (!equals(getId(), _o.getId())) {
/*  44 */         return false;
      }

/*  47 */       return true;
    }

/*  50 */     return false;
  }


/*  54 */   public Target findTarget(String id) { return (Target)this.m_targets.get(id); }


  public Target findOrCreateTarget(String id) {
/*  58 */     Target target = (Target)this.m_targets.get(id);

/*  60 */     if (target == null) {
/*  61 */       synchronized (this.m_targets) {
/*  62 */         target = (Target)this.m_targets.get(id);

/*  64 */         if (target == null) {
/*  65 */           target = new Target(id);
/*  66 */           this.m_targets.put(id, target);
        }
      }
    }

/*  71 */     return target;
  }


/*  75 */   public int getCount() { return this.m_count; }



/*  79 */   public String getId() { return this.m_id; }



/*  83 */   public int getLevel() { return this.m_level; }



/*  87 */   public Map<String, Target> getTargets() { return this.m_targets; }



  public int hashCode() {
/*  92 */     int hash = 0;

/*  94 */     return hash * 31 + ((this.m_id == null) ? 0 : this.m_id.hashCode());
  }



  public Operation incCount() {
/* 100 */     this.m_count++;
/* 101 */     return this;
  }

  public Operation incCount(int count) {
/* 105 */     this.m_count += count;
/* 106 */     return this;
  }


  public void mergeAttributes(Operation other) {
/* 111 */     assertAttributeEquals(other, "operation", "id", this.m_id, other.getId());

/* 113 */     this.m_level = other.getLevel();

/* 115 */     this.m_count = other.getCount();
  }


/* 119 */   public Target removeTarget(String id) { return (Target)this.m_targets.remove(id); }


  public Operation setCount(int count) {
/* 123 */     this.m_count = count;
/* 124 */     return this;
  }

  public Operation setId(String id) {
/* 128 */     this.m_id = id;
/* 129 */     return this;
  }

  public Operation setLevel(int level) {
/* 133 */     this.m_level = level;
/* 134 */     return this;
  }

  public Operation() {}
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/classes/!/com/dianping/cat/home/storage/alert/entity/Operation.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */